#ifndef _GEOMELLIPSOID_
#define _GEOMELLIPSOID_

#include "GeomObject.h"

// doesnt contain rotation
class GeomEllipsoid: public GeomObject{
protected:
	Vec3d mRadii;
public:
	// Constructor
	GeomEllipsoid(Vec3d _center, Vec3d _radius) : mRadii(_radius){
		for(int i=0; i<3; i++) mTransform[i][3]=_center[i];
		mType=ELLIPSOID;
	}
	GeomEllipsoid(Vec3d _radius) : mRadii(_radius){
		mType=ELLIPSOID;
	}
	
	bool isInside(Vec3d _pt){
		Vec3d _localPt = xform(getInvWorldTransform(), _pt);
		return sqrlen((_pt)/(mRadii))<1;
	}
	// Get signed distance to inPoint
	inline double getSignedDist(const Vec3d &inPoint){
		printf("Error in line %d in file %s: Not Yet Implemented!\n", __LINE__, __FILE__);
		return 0;
	}
	double getVolume(){
		return (4/3)*M_PI*mRadii[0]*mRadii[1]*mRadii[2];	//	4/3* Pi* a* b* c
	}

	void draw(Vec4d _col=Vec4d(vl_1), bool _default=true);

	inline Vec3d getRadii(){ return mRadii; }
	void setExtent(Vec3d _d){mRadii=_d/2;}

	// Transform a plane by the inverse of inInverseMatrix
	GeomObject* getObjApplyInvTransform(const Mat4d &_mat);

};

#endif
